{* $Id$ *}
{include_core file="admin/lib/header.html" title="素材管理"}
<div class="page-header border-bottom clearfix">
  <h2 class="left">素材管理<span>素材详情</span></h2>
  <a href='{AnUrl("material/admin?status={$info.status}&progress={$info.progress}")}' class="btn btn-default btn-sm right">&lt;&nbsp;返回素材列表</a>
</div>

<div class="add-form">
    <table class="table" cellpadding="0" cellspacing="0">
      <tr>
        <th><label for="" class="add-f-label">素材名：</label></th>
        <td>
          {$info.title}
        </td>
      </tr>
      <tr>
        <th><label for="" class="add-f-label">播放地址：</label></th>
        <td>
          {if $info.province}{$info.province}{$info.city}{else}全国{/if}
        </td>
      </tr>
      <tr>
        <th><label for="" class="add-f-label">停留时间：</label></th>
        <td>
          {$info.stop_time}(秒)
        </td>
      </tr>
      <tr>
        <th><label for="" class="add-f-label">审核状态：</label></th>
        <td class='js_result'>
          {if $info.progress == 1}正在审核{else if $info.progress == 2}审核通过{else}审核失败{/if}
        </td>
      </tr>
      <tr>
        <th><label for="" class="add-f-label">操作：</label></th>
        <td>
          {if $info.progress == 1}
            <a href='{AnUrl("material/admin/change_progress")}' class="btn btn-info btn-xs js_progress" res-id="{$info.id}" progress=2><i class="icon-edit icon-white"></i>通过审核</a>
            <a href='{AnUrl("material/admin/change_progress")}' class="btn btn-danger btn-xs js_progress" res-id="{$info.id}" progress=3><i class="icon-trash icon-white"></i>拒绝审核</a>
          {else if $info.progress == 2}
            <a href='{AnUrl("material/admin/change_progress")}' class="btn btn-info btn-xs js_progress" res-id="{$info.id}" progress=1><i class="icon-edit icon-white"></i>取消审核</a>
          {else}
            <a href='{AnUrl("material/admin/change_progress")}' class="btn btn-info btn-xs js_progress" res-id="{$info.id}" progress=2><i class="icon-edit icon-white"></i>通过审核</a>
          {/if}
        </td>
      </tr>
    </table>
    {if $info.type == 1}
      <img src='{_image("{$info.path}", "big")}' />
    {else}
      {* 视频待定 *}
    {/if}
</div>
{load_js file="uploadify/jquery.uploadify.min.js"}
<script>

$(function(){
  // 修改状态
  $('.js_progress').click(function(e){
    e.preventDefault();
    var thisObj = $(this);
    var url = thisObj.attr('href');
    var resId = thisObj.attr('res-id');
    var progress = thisObj.attr('progress');

    if (!resId) {
      showMsg('请选择要操作的内容');return false;
    }
    if (!progress) {
      showMsg('请选择要修改的状态');return false;
    }
    $.post(url, { 'id':resId, 'progress':progress }, function(json){
      if (json.info != 'ok') {
        showMsg(json.info);return false;
      }
      thisObj.closest('tr').remove();

      if (progress == 1) {
        var html = '正在审核';
      } else if (progress == 2) {
        var html = '审核通过';
      } else {
        var html = '审核失败';
      }
      $('.js_result').html(html);
    }, 'json');
  });
});
</script>
{include_core file="admin/lib/footer.html"}